import sys

from PyQt5.QtWidgets import QApplication
from component import Datagrid
from service import DataService

if __name__ == '__main__':
    userService = DataService.UserService()
    userList = userService.listUser()
    headers = [Datagrid.Header(key="userId", title="ID"), Datagrid.Header(key="username", title="登录账号"),
               Datagrid.Header(key="nickname", title="中文名")]

    print(userList)
    print(headers)

    myapp = QApplication(sys.argv)

    win = Datagrid.Table(title="用户列表", headers=headers, rows=userList)
    # win.show()

    # myDlg = QMainWindow()
    # myDlg.resize(800,600)
    # layout = QHBoxLayout()
    # layout.addWidget(win)
    # myDlg.setLayout(layout)
    # myDlg.show()
    sys.exit(myapp.exec_())
